<template>
  <div>
     <uni-list>
       <uni-list-chat
         v-for="(val,index) in items" 
         :key="index"
         to="../chatcon/chatcon" 
         :title="val.fromNickName" 
         avatar="../../../../static/cat.jpeg" 
         :note="val.msg" 
         :time="val.createTime" 
         badge-positon="left" 
         badge-text="1"
       ></uni-list-chat>
    </uni-list>
  </div>
</template>
<script>
export default {
  data() {
    return {
      items:[{
        fromNickName:"用户",
        msg:"你好！",
        createTime:"2020-05-28"
      }]
    }
  },
  methods: {
    goChat(){
      console.log(111);
      uni.navigateTo({
         url: '../chatcon/chatcon'
      });
    },
    initFn(){
      let token = this.$store.state.token
      let user = this.$store.state.user
      let searchUrl = 'http://39.106.224.223:8088/chat/msg/listSingleOffline'
      uni.request({
        url: searchUrl,
        header:{
          'content-type':'application/json',
          'Authorization':token
        },
        data:{account:user.account},
        method:'GET',
        success:res=>{
          console.log(res);
          if (res.data.code == 200) {
            // this.items = res.data.data;
          }
        }
      })
    }
  },
  onShow() {
    this.initFn()
  },
  
}
</script>
<style lang="">
  
</style>